<template>
	<view class="page">
		<u-empty-state v-if="records.length == 0" value="暂无相关记录" style="margin: auto;"></u-empty-state>
		<view class="ward" v-for="item in records" :key="item.id">
			<view class="amount">
				<view>{{ item.remark }}</view>
				<view>{{ item.disScore }}</view>
			</view>
			<view>
				<view class="orders">
					<view>
						<image
							src="https://res.jiuzhang-cloud.com/jzy-oss/upload/image/dti-hospital/agencies/orders_number.png">
						</image>
						<view>订单号</view>
					</view>
					<view>SP6486123347</view>
				</view>
				<view class="orders">
					<view>
						<image
							src="https://res.jiuzhang-cloud.com/jzy-oss/upload/image/dti-hospital/agencies/orders_time.png">
						</image>
						<view>订单时间</view>
					</view>
					<view>{{ item.createdTime }}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			pageNo: 1,
			total: 0,
			records: []
		}
	},
	onShow() {
		this.records = []
		this.pageNo = 1
		this.getIntegralLogs()
	},
	onReachBottom() {
		if (this.pageNo * 10 < this.total) {
			this.pageNo++
			this.getIntegralLogs()
		}
	},
	methods: {
		getIntegralLogs() {
			this.$api.getIntegralLogs({
				pageNo: this.pageNo,
				pageSize: 10
			}).then(e => {
				const { code, result: { records, total } } = e
				if (code == 200) {
					this.records.push.apply(this.records, records)
					this.total = total
				} else {
					uni.showToast({
						title: e.message,
						icon: 'none'
					});
				}
			})
		}
	}
}
</script>

<style lang="less">
@import './divideLogs.less';
</style>
